﻿using SqlSugar;

namespace LowCoding.Dto
{
    /// <summary>
    /// 模块
    /// </summary>
    public class SysModuleDto
    {
        /// <summary>
        /// 根节点Code
        /// </summary>
        public static string RootModuleCode = "-1";

        /// <summary>
        /// 根节点Id
        /// </summary>
        public static int RootModuleId = -999;

        /// <summary>
        /// 模块id
        /// </summary>
        [SugarColumn(ColumnName = "MDL_ID")]
        public string Id { get; set; }

        /// <summary>
        /// 模块功能代码
        /// </summary>
        [SugarColumn(ColumnName = "MDL_CODE")]
        public string ModuleCode { get; set; }

        /// <summary>
        /// 模块功能名称
        /// </summary>
        [SugarColumn(ColumnName = "MDL_NAME")]
        public string ModuleName { get; set; }

        private string _moduleType = "0";

        /// <summary>
        /// 类型
        /// </summary>
        [SugarColumn(ColumnName = "MDL_TYPE")]
        public string ModuleType
        {
            get { return _moduleType; }
            set { _moduleType = value; }
        }

        /// <summary>
        /// 父模块功能
        [SugarColumn(ColumnName = "MDL_PARENT")]
        public string ParentModuleCode { get; set; }

        private string _valid = "1";

        /// <summary>
        /// 是否可用
        /// </summary>
        [SugarColumn(ColumnName = "MDL_VALID")]
        public string Valid
        {
            get { return _valid; }
            set { _valid = value; }
        }

        public bool bValid
        {
            get { return Valid == "0"; }
            set
            {
                if (value) Valid = "0";
                else
                    Valid = "1";
            }
        }

        /// <summary>
        /// 菜单连接地址
        /// </summary>
        [SugarColumn(ColumnName = "MDL_URL")]
        public string ModuleUrl { get; set; }

        /// <summary>
        /// 序号
        /// </summary>
        [SugarColumn(ColumnName = "MDL_SEQ")]
        public int? ModuleSeq { get; set; }

        private string _isPlatformModule = "1";

        /// <summary>
        /// 是否是平台模块
        /// </summary>
        [SugarColumn(ColumnName = "MDL_ISP")]
        public string IsPlatformModule
        {
            get { return _isPlatformModule; }
            set { _isPlatformModule = value; }
        }

        /// <summary>
        /// 按钮图标样式
        /// </summary>
        [SugarColumn(ColumnName = "MDL_ICONCLS")]
        public string IconCls { get; set; }

        public bool bPValid
        {
            get { return IsPlatformModule == "0"; }
            set
            {
                if (value) IsPlatformModule = "0";
                else
                    IsPlatformModule = "1";
            }
        }

        public bool bPValidSys
        {
            get { return true; }
            set
            {
                if (value) IsPlatformModule = "0";
                else
                    IsPlatformModule = "0";
            }
        }

        /// <summary>
        /// 是否有权限
        /// </summary>
        public bool HasRights { get; set; }

        /// <summary>
        /// 第几级菜单
        /// </summary>

        public string MDL_LEVEL { get; set; }

        /// <summary>
        /// 父级是第几级菜单
        /// </summary>
        public string MDL_PARENTLEVEL { get; set; }
    }
}